<template>
	<view class="content">
		<view class="tech-eva-con">
			<view class="record-con">
				
				<block v-for="(item, index) in money_cash_list" :key="index">
					<view class="record-li">
						<view class="record-li-tp">
							<view class="record-tp-lf">提现-到{{item.bank_name}}({{item.bank_accounts}})</view>
							<view class="record-tp-rt">{{item.money}}</view>
						</view>
						<view class="record-li-bt">
							<view class="record-tp-lf">{{item.add_time_time}}</view>
							<view class="record-tp-rt">
								<block v-if="item.status == 0">
									<text>{{item.status_name}}</text>
								</block>
								<block v-else-if="item.status == 1">
									<text class="success">{{item.status_name}}</text>
								</block>
								<block v-else-if="item.status == 2">
									<text class="fail">{{item.status_name}}
										<block v-if="item.msg">
										({{item.msg}})
										</block>
									</text>
								</block>
							</view>
						</view>
					</view>
				</block>
				
			</view>
		</view>
	</view>
</template>

<script>
	const app = getApp();
	const request = require('../../utils/request');
	export default {
		data() {
			return {
				//获取技师提现列表参数
				params:{
					page:1, //分页
				},
				//技师提现列表
				money_cash_list:[],
				//上拉加载状态
				push_status:false,
			}
		},
		onLoad()
		{
			
		},
		onShow()
		{
			var that = this;
			
			that.params.page = 1;
			that.money_cash_list = [];
			that.load_money_cash(); //获取技师提现列表
		},
		onPullDownRefresh()
		{
			//console.log('下拉');
			var that = this;
			that.params.page = 1;
			that.money_cash_list = [];
			that.load_money_cash(); //获取技师提现列表
		},
		onReachBottom()
		{
			//console.log('上拉');
			var that = this;
			if(that.push_status == true)
			{
				that.load_money_cash(true); //获取技师提现列表
			}
		},
		methods: {
			/**
			 * 获取技师提现列表
			 */
			load_money_cash:function(is_push = false)
			{
				var that = this;
				var params = that.params;
				//网络请求
				request(app.globalData.api_url+'/v1/moneycash/lists', 'POST', params).then((res) => {
					uni.stopPullDownRefresh();
					if(res.data.code == 0)
					{
						let money_cash_list = that.money_cash_list;
						if(is_push == true)
						{
							//追加
							money_cash_list = money_cash_list.concat(res.data.data);
						}else
						{
							//更改
							money_cash_list = res.data.data;
						}
						that.money_cash_list = money_cash_list;
						that.params.page += 1;
						that.push_status = true;
					}else
					{
						uni.showToast({
							title:res.data.msg,
							icon:'none'
						});
						app.is_login_check(res.data);
						app.is_techn_check(res.data);
						that.push_status = false;
					}
				});
			}
		}
	}
</script>

<style lang="scss">
page{
	background-color: $uni-bg-color-grey;
}
.content{
	.tech-eva-con{
		margin:30rpx 20rpx;
		border-radius:20rpx;
		padding:20rpx 30rpx;
		background-color: #fff;
		.record-con{
			.record-li{
				padding:20rpx 0;
				border-bottom: 2rpx solid  $uni-bg-color-grey;
				&:last-child{
					border-bottom: none;
				}
				.record-li-tp{
					display: flex;
					justify-content: space-between;
					font-size: 28rpx;
					margin-bottom: 5rpx;
				}
				.record-li-bt{
					display: flex;
					justify-content: space-between;
					font-size: 24rpx;
					color: $uni-text-color-grey;
					.record-tp-rt{
					    text{
					        color: #000;
					        &.success{
					            color:$uni-text-color-active;
					        }
					        &.fail{
					            color:#f00;
					        }
					    }
				    }
				}
			}
		}
		.place-rem-tit{
			font-size: 28rpx;
			margin: 20rpx 0;
			text{
				&:first-child{
					font-weight: bold;
				}
				&:last-child{
					font-size: 24rpx;
					color: $uni-text-color-grey;
				}
			}
		}
	}
}
</style>